package x.y.z;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.PostMapping;
import x.y.z.model.DictType;
import x.y.z.repository.DictTypeRepository;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

@SpringBootApplication
public class JpaApp {
    public static void main(String[] args) {
        SpringApplication.run(JpaApp.class, args);
    }

    @Autowired
    DictTypeRepository rep;

    @PostConstruct
    public void init() throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        List<DictType> ls = rep.findAll();
        System.out.println(mapper.writeValueAsString(ls));
    }
}
